var net = require('net');
var makeData = require('../monitor/detector/helper/https').make;
var d = makeData('http://www.douban.com/');

console.log(d);
var client = new net.Socket({
  allowHalfOpen: true,
  readable: true,
  writable: true
});

// client.setTimeout(2000);

client.on('lookup',function(){
  console.log('lookup');
});

client.on('connect', function(){
  console.log('connect');
});

client.on('data',function(chunk){
  console.log(chunk.toString());

});

client.on('end',function(){
  console.log('end');
});

client.on('timeout',function(){
  console.log('timeout');
});

client.on('drain',function(){
  console.log('drain');
});

client.on('error', function(e){
  console.log(error.toString);
});

client.on('close',function(){
  console.log('close');
});

client.connect(d.opts.port, d.opts.host);



client.write(d.data);


setTimeout(function(){}, 10000);

client.end();

// client.destroy();